package com.cskaoyan.bean.vo;

import com.cskaoyan.bean.po.MarketGoods;
import com.cskaoyan.bean.po.MarketTopic;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Trellis
 * @since 2022/09/09 11:32
 */
public class WxTopicDetailVo {

    /**
     * topic : {"picUrl":"http://182.92.235.201:8083/wx/storage/fetch/18zqq2wz1ktuwvs1yvo8.jpg","deleted":false,"addTime":"2022-09-08 22:22:54","price":111,"subtitle":"11sdfg","sortOrder":100,"goods":[1181050],"updateTime":"2022-09-09 10:06:15","id":359,"title":"11dfgh","readCount":"11","content":"<p>111111asdfg<\/p>"}
     * goods : [{"brief":"超大气","picUrl":"http://182.92.235.201:8083/wx/storage/fetch/b4qvclguh9q0gf9d4thr.jpg","name":"iphone14pro","counterPrice":7999,"id":1181050,"isNew":true,"retailPrice":0,"isHot":true}]
     */
    private TopicEntity topic = new TopicEntity();
    private List<GoodsEntity> goods = new ArrayList();


    public void copyTopic(MarketTopic marketTopic) {
        TopicEntity topicEntity = new TopicEntity();
        Integer[] goods = marketTopic.getGoods();
        for (Integer good : goods) {
            topicEntity.goods.add(good);
        }
        BeanUtils.copyProperties(marketTopic,topicEntity);
        topic = topicEntity;
    }

    public void copyGoods(MarketGoods marketGoods) {
        GoodsEntity goodsEntity = new GoodsEntity();
        BeanUtils.copyProperties(marketGoods,goodsEntity);
        goods.add(goodsEntity);
    }
    public void setTopic(TopicEntity topic) {
        this.topic = topic;
    }

    public void setGoods(List<GoodsEntity> goods) {
        this.goods = goods;
    }

    public TopicEntity getTopic() {
        return topic;
    }

    public List<GoodsEntity> getGoods() {
        return goods;
    }

    public class TopicEntity {
        /**
         * picUrl : http://182.92.235.201:8083/wx/storage/fetch/18zqq2wz1ktuwvs1yvo8.jpg
         * deleted : false
         * addTime : 2022-09-08 22:22:54
         * price : 111.0
         * subtitle : 11sdfg
         * sortOrder : 100
         * goods : [1181050]
         * updateTime : 2022-09-09 10:06:15
         * id : 359
         * title : 11dfgh
         * readCount : 11
         * content : <p>111111asdfg</p>
         */
        private String picUrl;
        private boolean deleted;
        private String addTime;
        private double price;
        private String subtitle;
        private int sortOrder;
        private List<Integer> goods = new ArrayList<>();
        private String updateTime;
        private int id;
        private String title;
        private String readCount;
        private String content;

        public void setPicUrl(String picUrl) {
            this.picUrl = picUrl;
        }

        public void setDeleted(boolean deleted) {
            this.deleted = deleted;
        }

        public void setAddTime(String addTime) {
            this.addTime = addTime;
        }

        public void setPrice(double price) {
            this.price = price;
        }

        public void setSubtitle(String subtitle) {
            this.subtitle = subtitle;
        }

        public void setSortOrder(int sortOrder) {
            this.sortOrder = sortOrder;
        }

        public void setGoods(List<Integer> goods) {
            this.goods = goods;
        }

        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime;
        }

        public void setId(int id) {
            this.id = id;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public void setReadCount(String readCount) {
            this.readCount = readCount;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public String getPicUrl() {
            return picUrl;
        }

        public boolean isDeleted() {
            return deleted;
        }

        public String getAddTime() {
            return addTime;
        }

        public double getPrice() {
            return price;
        }

        public String getSubtitle() {
            return subtitle;
        }

        public int getSortOrder() {
            return sortOrder;
        }

        public List<Integer> getGoods() {
            return goods;
        }

        public String getUpdateTime() {
            return updateTime;
        }

        public int getId() {
            return id;
        }

        public String getTitle() {
            return title;
        }

        public String getReadCount() {
            return readCount;
        }

        public String getContent() {
            return content;
        }
    }

    public class GoodsEntity {
        /**
         * brief : 超大气
         * picUrl : http://182.92.235.201:8083/wx/storage/fetch/b4qvclguh9q0gf9d4thr.jpg
         * name : iphone14pro
         * counterPrice : 7999.0
         * id : 1181050
         * isNew : true
         * retailPrice : 0.0
         * isHot : true
         */
        private String brief;
        private String picUrl;
        private String name;
        private double counterPrice;
        private int id;
        private boolean isNew;
        private double retailPrice;
        private boolean isHot;

        public void setBrief(String brief) {
            this.brief = brief;
        }

        public void setPicUrl(String picUrl) {
            this.picUrl = picUrl;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setCounterPrice(double counterPrice) {
            this.counterPrice = counterPrice;
        }

        public void setId(int id) {
            this.id = id;
        }

        public void setIsNew(boolean isNew) {
            this.isNew = isNew;
        }

        public void setRetailPrice(double retailPrice) {
            this.retailPrice = retailPrice;
        }

        public void setIsHot(boolean isHot) {
            this.isHot = isHot;
        }

        public String getBrief() {
            return brief;
        }

        public String getPicUrl() {
            return picUrl;
        }

        public String getName() {
            return name;
        }

        public double getCounterPrice() {
            return counterPrice;
        }

        public int getId() {
            return id;
        }

        public boolean isIsNew() {
            return isNew;
        }

        public double getRetailPrice() {
            return retailPrice;
        }

        public boolean isIsHot() {
            return isHot;
        }
    }
}
